//
//  ZCXActivityTableViewCell.m
//  LoveOfPet
//
//  Created by dllo on 15/11/13.
//  Copyright © 2015年 孔维. All rights reserved.
//

#import "ZCXActivityTableViewCell.h"
#import <SDWebImageManager.h>
#import <UIImageView+WebCache.h>
#define HEIGHT  [[UIScreen mainScreen]bounds].size.height / 667
#define WIDTH   [[UIScreen mainScreen]bounds].size.width / 375
@interface ZCXActivityTableViewCell ()
@property (nonatomic, retain) UIImageView *imageV;
@property (nonatomic, retain) UILabel *titleName;
@end

@implementation ZCXActivityTableViewCell
- (void)dealloc{
    [_activity release];
    [_imageV release];
    [_titleName release];
    [super dealloc];
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _imageV = [[UIImageView alloc]init];
        [self.contentView addSubview:_imageV];
        _titleName = [[UILabel alloc]init];
        [self.imageV addSubview:_titleName];
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    _imageV.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
    _titleName.frame = CGRectMake(0, _imageV.frame.size.height - 40 * HEIGHT, _imageV.frame.size.width, 40 * HEIGHT);
}
- (void)setActivity:(ActivityModel *)activity{
    if (_activity != activity) {
        [_activity release];
        _activity = [activity retain];
    }
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:activity.coverpath]];
    self.titleName.textColor = [UIColor whiteColor];
    self.titleName.shadowColor = [UIColor grayColor];
    self.titleName.text = [NSString stringWithFormat:@"    %@", activity.tag];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
